<?php 

class SessionForm extends sfForm
{
  public function configure()
  {
    $this->setWidgets(array(
      'email'    => new sfWidgetFormInputText(),
      'password' => new sfWidgetFormInputPassword()
    ));

    $this->setValidators(array(
      'email'    => new sfValidatorEmail(
        array(), 
        array('required' => '请输入Email', 'invalid' => 'Email格式不正确')
      ),
      'password' => new sfValidatorString(
        array('min_length' => '6'), 
        array('required' => '请输入密码', 'min_length' => '密码长度不够')
      )
    ));

    $this->validatorSchema->setPostValidator(new DoctrineValidatorAccount());

    $this->widgetSchema->setNameFormat('session[%s]');
  }
}
